package com.woke.data;

import android.text.TextUtils;

import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;

/**
 * Created by Administrator on 2017/4/18 0018.
 */

public class BankCard extends RealmObject {
    @PrimaryKey
    private int id;
    private String name;
    private String idcard;  //身份证号
    private String code;    //验证码
    private String phone;   //手机号
    private int user_id;
    private String cardno;   //银行卡号
    private int type;    //类型  0信用卡 1储蓄卡
    private String bindid;     //绑卡ID
    private String validthru;
    private String identityid;
    private String brname;    //银行名称

    /*新增2017/6/23*/
    private int kind;//1为充值卡 2为到账卡
    private String curr;//是否为当前卡

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIdcard() {
        return idcard;
    }

    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public int getUser_id() {
        return user_id;
    }

    public void setUser_id(int user_id) {
        this.user_id = user_id;
    }

    public String getCardno() {
        return cardno;
    }

    public void setCardno(String cardno) {
        this.cardno = cardno;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getBindid() {
        return bindid;
    }

    public void setBindid(String bindid) {
        this.bindid = bindid;
    }

    public String getValidthru() {
        return validthru;
    }

    public void setValidthru(String validthru) {
        this.validthru = validthru;
    }

    public String getIdentityid() {
        return identityid;
    }

    public void setIdentityid(String identityid) {
        this.identityid = identityid;
    }

    public String getBrname() {
        return brname;
    }

    public void setBrname(String brname) {
        this.brname = brname;
    }

    public int getKind() {
        return kind;
    }

    public void setKind(int kind) {
        this.kind = kind;
    }

    public String getCurr() {
        return curr;
    }

    public void setCurr(String curr) {
        this.curr = curr;
    }

    /**
     * 银行卡类型
     *
     * @return
     */
    public String getBankCardTypeName() {
        switch (type) {
            case 0:
                return "信用卡";
            case 1:
                return "储蓄卡";
            default:
                return "储蓄卡";
        }
    }

    /**
     * 银行卡号最后4位
     *
     * @return
     */
    public String getCardNoLast4() {
        if (TextUtils.isEmpty(cardno)) {
            return "";
        } else if (cardno.length() <= 4) {
            return cardno;
        } else {
            return cardno.substring(cardno.length() - 4, cardno.length());
        }
    }
}
